/* Odoo 18 Chatter 布局优化 */

/* 让Chatter更窄，给表单更多空间 */
.o-mail-Chatter {
    max-width: 400px;
    min-width: 350px;
}

/* 添加一个明显的收放按钮到Chatter顶部 */
.o-mail-Chatter-topbar {
    position: relative;
}

/* 在Chatter顶部添加收放按钮 */
.o-mail-Chatter-topbar::after {
    content: "📋";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.o-mail-Chatter-topbar::after:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-50%) scale(1.1);
}

/* 折叠状态时完全隐藏，表单占满宽度 */
.o-mail-Chatter.o-isCollapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    padding: 0;
    border: none;
}

/* 表单区域自适应 */
.o_form_sheet_bg {
    transition: max-width 0.3s ease;
}

/* Chatter折叠时表单占满宽度 */
.o_form_view:has(.o-mail-Chatter.o-isCollapsed) .o_form_sheet_bg {
    max-width: 100%;
}

/* 让原有的折叠按钮更明显（如果存在） */
.o-mail-Chatter-topbar button[title*="fold"],
.o-mail-Chatter-topbar button[title*="unfold"],
.o-mail-Chatter-topbar .btn-link {
    font-size: 18px;
    padding: 8px 12px;
    opacity: 0.7;
    margin-right: 30px; /* 为我们的自定义按钮留空间 */
}

.o-mail-Chatter-topbar button:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* 添加JavaScript控制的收放功能 */
.chatter-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
    transition: all 0.2s ease;
}

.chatter-toggle-btn:hover {
    background: #0056b3;
    transform: translateY(-50%) scale(1.05);
}

.chatter-toggle-btn.collapsed {
    background: #6c757d;
}

/* 移动端优化：默认隐藏Chatter */
@media (max-width: 768px) {
    .o-mail-Chatter {
        display: none;
    }
    
    .o-mail-Chatter.o-isExpanded {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 1000;
        background: white;
    }
}

